package com.pearadmin.pro.common.interceptor;

import com.pearadmin.pro.common.constant.SecurityConstant;
import com.pearadmin.pro.common.web.interceptor.RateLimitInterceptor;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 专业拦截器
 *
 * @author ZhouXingYun
 * @date 2022/8/1 11:22
 */
@Configuration
@Log4j2
public class MajorInterceptor implements WebMvcConfigurer {

    @Resource
    private MajorInterceptProcessing majorInterceptProcessing;

    public void addInterceptors(InterceptorRegistry registry) {
        log.info("专业拦截器启动---"+registry);
        //addPathPatterns指定拦截器要拦截的路径
        //excludePathPatterns指定拦截器不拦截的路径
        registry.addInterceptor(majorInterceptProcessing).addPathPatterns("/**").excludePathPatterns(SecurityConstant.HTTP_ACT_MATCHERS.split(","));
    }


}
